﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="card"
    targetNamespace="http://game.xyzshell.org/opencg/card.xsd"
    elementFormDefault="qualified"
    xmlns="http://game.xyzshell.org/opencg/card.xsd"
    xmlns:mstns="http://game.xyzshell.org/opencg/card.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>

    <xs:complexType name="propertiesType">
      <xs:sequence>
        <xs:element name="property" type="propertyType" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>

  <xs:complexType name="propertyType">
    <xs:attribute name="name" type="xs:string" use="required"/>
    <xs:attribute name="value" type="xs:string" use="required"/>
  </xs:complexType>

    <xs:complexType name="affectType">
      <xs:sequence>
        <xs:element name="condition" type="conditionType"/>
        <xs:element name="action" type="actionType"/>
      </xs:sequence>
    </xs:complexType>

    <xs:complexType name="conditionType" >
      <xs:choice>
        <xs:element name="expression" type="expressionType" />
        <xs:element name="logic" type="logicType"/>
      </xs:choice>
      <xs:attribute name="type" type="xs:string" use="required"/>
    </xs:complexType>

    <xs:complexType name="logicType">
      <xs:sequence minOccurs="1" maxOccurs="2">
        <xs:element name="condition" type="conditionType"/>
      </xs:sequence>
      <xs:attribute name="type" use="required">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="AND"></xs:enumeration>
            <xs:enumeration value="OR"></xs:enumeration>
            <xs:enumeration value="NOT"></xs:enumeration>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>

  <xs:complexType name="expressionType">
    <xs:sequence minOccurs="0">
      <xs:element name="params" type="paramsType"  />
    </xs:sequence>
    <xs:attribute name="type" use="required" type="xs:string"/>
    <xs:attribute name="value"  type="xs:string"/>   
  </xs:complexType>

  <xs:complexType name="paramsType">
    <xs:sequence>
      <xs:element name="param" type="paramType"  minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="paramType">
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="value" use="required" type="xs:string"/>
    <xs:attribute name="type" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="standard"></xs:enumeration>
          <xs:enumeration value="path"></xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

    <xs:complexType name="actionType" >
      <xs:choice>
        <xs:element name="setter" type="flowType"/>
        <xs:element name="flow" type="flowType"/>
      </xs:choice>
    </xs:complexType>

  <xs:complexType name="setterType">
  </xs:complexType>

  <xs:complexType name="flowType">
  </xs:complexType>

  <xs:complexType name="cardType">
      <xs:sequence>
        <xs:element name="properties" type="propertiesType" />
        <xs:element  name="affect" type="affectType"/>
      </xs:sequence>
  </xs:complexType>
  
  
  <xs:element name="card" type="cardType"/>
  
</xs:schema>

